package top.fyukina.fymil.elements;

import top.fyukina.fymil.Registry;
import java.math.MathContext;
import java.util.HashMap;
import java.util.Map;

public class Environment {
    private final Map<String, Object> properties;
    private final Runtime runtime;
    private final ProgramPack programPack;
    private final Program program;
    private final VarDomainStack varDomainStack;
    private final Registry registry;
    public Environment(ProgramPack pack, Program program,
                       VarDomainStack varDomainStack, Registry registry) {
        properties = new HashMap<>();
        properties.put("numPrecision", 3);
        properties.put("numScale", MathContext.DECIMAL128);
        runtime = Runtime.getRuntime();
        programPack = pack;
        this.program = program;
        this.varDomainStack = varDomainStack;
        this.registry = registry;
    }
    public Runtime runtime() {
        return runtime;
    }
    public ProgramPack pack() {
        return programPack;
    }
    public Program program() {
        return program;
    }
    public VarDomainStack var() {
        return varDomainStack;
    }
    public Map<String, Object> p() {
        return properties;
    }
    public Object p(String pName) {
        return properties.get(pName);
    }
    public Registry reg() {
        return registry;
    }
}